<?php
	class phuongthucthanhtoan{
		public function getPhuongThucThanhToanByWhere($where,$order){
			
			$db = new db();
			$db->getInstance();
			$sql = "select * from tblphuongthucthanhtoan";
			if($where != '') $sql .= ' where ' . $where;
			if($order != '') $sql .= ' order by ' . $order;
			$rs = mysql_query($sql);
			while($rc = mysql_fetch_object($rs)){
				$lstHangSanXuat[] = $rc;	
			}
			return $lstHangSanXuat;
		}
		
		public function getPhuongThucThanhToanById($id){
			$db = new db();
			$db->getInstance();
			$sql = "Select * from tblphuongthucthanhtoan where id = " . $id;
			$rs = mysql_query($sql);
			if(mysql_num_rows($rs)>0){
				$rc = mysql_fetch_object($rs);
				
				return $rc;
			}
			
			return $null;
		}
		
		public function insert($hang){
			$db = new db();
			$db->getInstance();
			$sql = "Insert tblphuongthucthanhtoan(MoTa,PhiDichVu,TrangThai) values('".$hang->MoTa."',".$hang->PhiDichVu.",".$hang->TrangThai.")"; //echo $sql; die;
			$rs = mysql_query($sql);
			if($rs) return true;
			else return false;
		}
		
		public function update($hang){
			$db = new db();
			$db->getInstance();
			$sql = "Update tblphuongthucthanhtoan set MoTa='".$hang->MoTa."',PhiDichVu=".$hang->PhiDichVu.",TrangThai=".$hang->TrangThai." where id =".$hang->id; //echo $sql; die;
			$rs = mysql_query($sql);
			if($rs) return true;
			else return false;
		}
		
		public function delete($id){
			$db = new db();
			$db->getInstance();
			$sql = "delete from tblphuongthucthanhtoan where id=".$id; //echo $sql; die;
			$rs = mysql_query($sql);
			if($rs) return true;
			else return false;
		}
	}
?>